package {{packageName}}.sample.application;

import org.springframework.stereotype.Component;
import {{packageName}}.sample.domain.BeerId;
import {{packageName}}.shared.kipe.application.AccessChecker;
import {{packageName}}.shared.kipe.application.AccessContext;
import {{packageName}}.shared.kipe.application.{{ baseName }}Authorizations;

@Component
class BeerIdAccessChecker implements AccessChecker<BeerId> {

  private final {{ baseName }}Authorizations authorizations;

  public BeerIdAccessChecker({{ baseName }}Authorizations authorizations) {
    this.authorizations = authorizations;
  }

  @Override
  public boolean can(AccessContext<BeerId> access) {
    return authorizations.allAuthorized(access.authentication(), access.action(), BeerResource.BEERS);
  }
}
